<?php $key = 'header_' . (empty($this->loggedin_user->_id) ? '0' : (string)$this->loggedin_user->_id) .'__'.(!empty($this->current_language) ? (string) $this->current_language : '')?>
<?php //echo $key.'----------------1';?>
<?php $this->JQuery()->javascriptCaptureStart() ?>
$j(document).ready(function() {
	$j('#al-txa').val('');
	$j('#al-tagsipt').val('');
	$j('#al-tagsipt').val('');
	
	$j('#postnewlisting').click(function(){
		$j( "#al-mblog-box" ).css({'display':'block', 'background':'#ffffff'});
		$j('#show-iframe-loading').show();
		$j('.blockOverlay').css('display','block');	
		$('#uploadbox').attr('src', "<?php echo $this->geturl('addanadlocal', 'listing', null, 'default'); ?>");
		$('#uploadbox').hide();
	})
	$('#uploadbox').load(function(){
		$j('#show-iframe-loading').hide();
		$j('#uploadbox').show();
	})
	$j('.al-close').click(function(){
		$j( "#al-mblog-box" ).css('display','none');
		$j('.blockOverlay').css('display','none');
		$j('#uploadbox').attr('src', '');
	})
	
	$j('#al-txa').focusin(function(){
		$j('#al-txa-lb').css('display','none');
	})
	$j('#al-txa').focusout(function(){
		if($j(this).val() == '')
		{
			$j('#al-txa-lb').css('display','block');
		}
	})
	
	$j('#al-tagsipt').focusin(function(){
		$j('#al-tagsipt-lb').css('display','none');
	})
	$j('#al-tagsipt').focusout(function(){
		if($j(this).val() == '')
		{
			$j('#al-tagsipt-lb').css('display','block');
		}
	})
	
	$j('#al-upbtn').click(function(){
		
	})
	$j('#changetolocal').click(function(){
		$j(this).parent().find('span').text('本地上传图片');
		$j(this).hide();
		$j('.al-fedv').hide();
		$j('.al-updv').show();
		$j('.al-size').show();
		$j('#changetourl').show();
	})
	$j('#changetourl').click(function(){
		$j(this).parent().find('span').text('粘贴网址抓取');
		$j(this).hide();
		$j('.al-fedv').show();
		$j('.al-updv').hide();
		$j('.al-size').hide();
		$j('#changetolocal').show();
	})
	
	$j('#al-tagssel a').click(function(){
		if($(this).hasClass('added'))
		{
			$j('#al-tagsipt')[0].focus();
			return false;
		}else{
			$j(this).addClass('added');
			$j('#al-tagsipt-lb').css('display','none');
			$j('#al-tagsipt').val($j('#al-tagsipt').val()+$j(this).text()+' ');
			$j('#al-tagsipt')[0].focus();
		}
	})
	
	$j('#al-tagsipt').keyup(function(){
		var tagArr = $j(this).val().split(' ');
		$j('#al-tagssel a').each(function(){
			if(jQuery.inArray($j(this).text(), tagArr) == -1){
				$j(this).removeClass('added');
			}else{
				$j(this).addClass('added');
			}
		})
	})
})
<?php $this->JQuery()->javascriptCaptureEnd() ?>
<?php if (($output = $this->cacheOutput()->start($key)) === false):?>
    <header class="header">
        <h6 id="logo"><a href="/">猫找网<span>MaoZhao.com</span></a></h6>
        <section class="region">
			<?php 
			$subname = explode('.', $_SERVER['HTTP_HOST']); 
			$subs = array (
				'beijing' => '北京',
				'shanghai' => '上海',
				'hangzhou' => '杭州',
				'guangzhou' => '广州',
				'shenzhen' => '深圳'
			);
			
			foreach($subs as $r => $v){
				if($r == $subname[0]){
					$sub = $v;
				}
			}
			?>
            <h3><?php echo $sub;?></h3>
            <section class="change">
            <span>切换城市</span>
                <ul>
                    <li><a href="http://<?php echo str_replace(SUBDOMAIN_ONLY, 'beijing', $_SERVER['HTTP_HOST'])?>">北京</a></li>
                    <li><a href="http://<?php echo str_replace(SUBDOMAIN_ONLY, 'shanghai', $_SERVER['HTTP_HOST'])?>">上海</a></li>
                    <li><a href="http://<?php echo str_replace(SUBDOMAIN_ONLY, 'hangzhou', $_SERVER['HTTP_HOST'])?>">杭州</a></li>
                    <li><a href="http://<?php echo str_replace(SUBDOMAIN_ONLY, 'guangzhou', $_SERVER['HTTP_HOST'])?>">广州</a></li>
                    <li><a href="http://<?php echo str_replace(SUBDOMAIN_ONLY, 'shenzhen', $_SERVER['HTTP_HOST'])?>">深圳</a></li>
                </ul>
            </section>
        </section>
        <section class="search">
            <form action="<?php echo $this->geturl('regular','search')?>" method="get">
                <input type="text" name="keyword" value=""/>
                <button type="submit"><?php echo $this->t('Search');?></button>
            </form>
        </section>
        <section class="login">
        <?php if(empty($this->loggedin_user->_id)):?>
            <ul>
                <li><a href="<?php echo $this->geturl('register','user')?>">注册</a></li>
                <li><a href="<?php echo $this->geturl('login','user')?>">登录</a></li>
                <!--li class="weibo"><a href="#">微博登录</a></li-->
            </ul>
        <?php else:?>
            <ul>
                <li class="user">                
                    <figure>
                        <a href="<?php echo $this->geturl('my-account', 'user')?>">
                            <img src="<?php echo $this->thumbnail()->scale(!empty($this->loggedin_user->cid) ? $this->loggedin_user->company->image : $this->loggedin_user->pp, 33, 33, true, true);?>">
                        </a>
                    </figure>
                    <a href="<?php echo $this->geturl('my-account', 'user')?>" class="name"><?php echo $this->loggedin_user->username?></a>
                </li>
                <li><a href="<?php echo $this->geturl('logout', 'user')?>">登出</a></li>
            </ul>
        <?php endif;?>
        <p class="post new button em">
        	<a href="<?php echo $this->geturl('post-an-ad','listing')?>">发新讯息</a>
        	<a href="#" id='postnewlisting'>test</a>
        </p>
        </section>
        
        <div style="display: none;z-index: 9000; border: medium none; margin: 0pt; padding: 0pt; width: 100%; height: 100%; top: 0pt; left: 0pt; background-color: rgb(0, 0, 0);filter:alpha(opacity=50); -moz-opacity:0.5; -khtml-opacity: 0.5; opacity: 0.4; position: fixed;" class="blockUI blockOverlay">
        </div>
		<div id="al-mblog-box" style="background:#ffffff; display: none; position: fixed; z-index: 9999; padding: 0px; margin: -273px 0px 0px -480px; width: 958px; top: 50%; left: 50%; text-align: left; color: rgb(0, 0, 0); border: medium none; background: none repeat scroll 0% 0% transparent; height: 586px;" class="blockUI blockMsg blockPage">
			<a href="javascript:;" class="al-close" style="position: absolute; right: 0;">close</a>
			<div id="show-iframe-loading" style="display:none;">正在加载，请稍后<img src="/images/loading2.gif"></div>
	        <iframe src="" style="display:none; border: 0px; width:958px; height:586px;" scrolling="no" id="uploadbox"></iframe>
		</div>
    </header>
<?php endif;?>
<?php if ((boolean) (string) $this->placeholder('display-commercial1')):?>
    <?php //echo $this->partial('index/commercial-zone1.phtml','default');?>
<?php endif;?>
